<template>
	<view class="container">
		<view class="content">
			<view style="display: flex;justify-content: space-between;margin-right: 10px">
				<radio-group style="display: flex;justify-content: space-between;margin-right: 10px"  @change="billtypeChange">
					<view>
						{{form.ppbarcode}}
					<label><radio :disabled="changeAble" value="生产质检" :checked="form.billtype == '生产质检'" name="billtype" />生产质检</label>
					</view>
					<view>
					<label><radio :disabled="changeAble" value="最终质检" :checked="form.billtype == '最终质检'" name="billtype"/>最终质检</label>
					</view>
					<view>
					<label><radio :disabled="changeAble" value="半成品" :checked="form.billtype == '半成品'" name="billtype"/>半成品</label>
					</view>
					<view>
					<label><radio :disabled="changeAble" value="成品" :checked="form.billtype == '成品'" name="billtype"/>成品</label>
					</view>
				</radio-group>
				<view style="display: flex;">
					<!-- <button style="height: 20rpx;font-size: 8rpx;" type="primary" @click="scan" :disabled="!form.id">单据选择</button>
					<button style="height: 20rpx;font-size: 8rpx;" type="warn" @click="copyOriginBill" :disabled="!form.id">复制</button>
					 -->
					 <!-- <button style="height: 20rpx;font-size: 8rpx;" type="warn" @click="copy" :disabled="!form.id">单据复制</button> -->
				</view>
				
				<view>
				抽样标准:GB2828.1-2012
				</view>
			</view>
		</view>
		<scroll-view  scroll-x="true">
			<text v-for="item,index in barcodes" v-bind:key="index">
				|{{item.cbarcode}}|
			</text>
		</scroll-view>
		<table class="table">
		  <thead>
		  <tr>
			<td class="topth">
			  拉别/品牌
			</td>
			<td> <input :disabled="changeAble" v-model="form.cdefine33"/>/{{form.cfree2}}</td>
			</td>
			<td class="topth">
			  单号/生产日期
			</td>
			    <td>{{ form.ccode }}/{{ form.ddate }}</td>
			<td class="topth">
			  需求跟踪号
			</td>
			<td> {{ form.csocode }}</td>
		  </tr>
		  <tr>
			<td class="topth">
			  产品型号
			</td>
			<td> {{ form.csoinvname }}</td>
			<td class="topth">
			  订单数/本次数
			</td>
			<td><div style = "display: flex;">{{ form.qty }}/{{ form.qcyqty }}</div></td>
			<td class="topth">
			  抽样数
			</td>
			<td> <input :disabled="changeAble" v-model="form.checkqty" type="number"  class="topth" > </td>
		  </tr>
		  </thead>
		</table>
		
		<table class="table">
		  <thead>
		  <tr>
			<th width="50px" rowspan="3">
			  产品要求核对
			</th>
			<th class="mincell" rowspan="2">
			  过充
			</th>
			<th class="mincell" rowspan="2">
			  过放
			</th>
			<th class="mincell" rowspan="2">
			  DC
			</th>
			<th class="mincell" rowspan="2">
			  AC
			</th>
			<th class="mincell" rowspan="2">
			  S-AC
			</th>
			<th class="mincell" rowspan="2">
			  电压
			</th>
			<th class="mincell" rowspan="2">
			  电源线
			</th>
			<th class="mincell" rowspan="2">
			  充电
			</th>
			<th class="mincell" rowspan="2">
			  拉线开关
			</th>
			<th class="mincell" rowspan="2">
			  检测开关
			</th>
			<th class="mincell" rowspan="2">
			  反光纸
			</th>
			<th class="mincell" rowspan="2">
			  防水
			</th>
			<th class="mincell" rowspan="2">
			  外置天线
			</th>

			<th class="mincell" colspan="2">
			  LED
			</th>
			<th class="mincell" colspan="3">
			  电筒功能
			</th>
			<th class="mincell" colspan="2">
			  射灯
			</th>
			<th class="mincell" colspan="2">
			  电池
			</th>
			<th class="mincell" rowspan="2">
			  使用时间
			</th>
			<th class="mincell" colspan="2">
			  索件
			</th>
			<th class="mincell" rowspan="2">
			  整灯
			</th>
			<th class="mincell" rowspan="2">
			  散件
			</th>
		  </tr>
		  <tr>
			<th class="mincell">
			  串
			</th>
			<th class="mincell">
			  并
			</th>
			<th class="mincell">
			  单
			</th>
			<th class="mincell">
			  双
			</th>
			<th class="mincell">
			  三
			</th>
			<th class="mincell">
			  LED
			</th>
			<th class="mincell">
			  灯珠
			</th>
			<th class="mincell">
			  片数
			</th>
			<th class="mincell">
			  重量
			</th>
			<th class="mincell">
			  用料
			</th>
			<th class="mincell">
			  颜色配置
			</th>
		  </tr>
		  <tr>
			<td>
			  <select-box :disabled="changeAble" class="cselect" :select="options" :text="form.guochong"  @selectbox="form.guochong = $event"></select-box>
			</td>
			<td>
			  <select-box :disabled="changeAble" class="cselect" :select="options" :text="form.guofang" @selectbox="form.guofang = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dc" @selectbox="form.dc = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.ac"  @selectbox="form.ac = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.sac" @selectbox="form.sac = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dianya" @selectbox="form.dianya = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dianyuanxian" @selectbox="form.dianyuanxian = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.chondian" @selectbox="form.chondian = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.laxiankaiguan" @selectbox="form.laxiankaiguan = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.jiancekaiguan" @selectbox="form.jiancekaiguan = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.fanguangzhi" @selectbox="form.fanguangzhi = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.fangshui" @selectbox="form.fangshui = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.waizhitianxian" @selectbox="form.waizhitianxian = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.ledchuan" @selectbox="form.ledchuan = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.ledbing" @selectbox="form.ledbing = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.diantongdan" @selectbox="form.diantongdan = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.diantongshuang" @selectbox="form.diantongshuang = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.diantongsan" @selectbox="form.diantongsan = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.shedengled" @selectbox="form.shedengled = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.shedengdanzhu" @selectbox="form.shedengdanzhu = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dianchipainshu" @selectbox="form.dianchipainshu = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dianchizhongliang" @selectbox="form.dianchizhongliang = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.shiyongshijian" @selectbox="form.shiyongshijian = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.suojianyongliao" @selectbox="form.suojianyongliao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.suojianyanse" @selectbox="form.suojianyanse = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.zhengdeng" @selectbox="form.zhengdeng = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.sandjian" @selectbox="form.sandjian = $event"></select-box>
			</td>
		  </tr>
		  <tr>
			<th width="50px" rowspan="3">
			  包装及丝印核对
			</th>
			<th class="mincell" rowspan="2">
			  客户型号
			</th>
			<th class="mincell" rowspan="2">
			  品牌
			</th>
			<th class="mincell" rowspan="2">
			  光管
			</th>
			<th class="mincell" rowspan="2">
			  电池
			</th>
			<th class="mincell" rowspan="2">
			  塑件
			</th>
			<th class="mincell" rowspan="2">
			  PCS/CN
			</th>
			<th class="mincell" rowspan="2">
			  内包装
			</th>
			<th class="mincell" rowspan="2">
			  彩盒
			</th>
			<th class="mincell" rowspan="2">
			  说明书保修卡等
			</th>
			<th class="mincell" rowspan="2">
			  胶袋⌒ 文字 ︶
			</th>
			<th class="mincell" rowspan="2">
			  正唛
			</th>
			<th class="mincell" rowspan="2">
			  侧唛
			</th>

			<th class="mincell" colspan="8">
			  标贴
			</th>
			<th class="mincell" colspan="7" rowspan="2">
			  卡通（颜色/字体/文字/封箱胶）
			</th>
		  </tr>
		  <tr>
			<th class="mincell">
			  产地标
			</th>
			<th class="mincell">
			  QC标
			</th>
			<th class="mincell">
			  电压标
			</th>
			<th class="mincell">
			  封口标
			</th>
			<th class="mincell">
			  条形标
			</th>
			<th class="mincell">
			  认证标
			</th>
			<th class="mincell" colspan="2">
			  其它标
			</th>
		  </tr>
		  <tr>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.kehuxinghao"  @selectbox="form.kehuxinghao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.pingpai" @selectbox="form.pingpai = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.guangguan" @selectbox="form.guangguan = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dianchi" @selectbox="form.dianchi = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.suojian" @selectbox="form.suojian = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.pcs" @selectbox="form.pcs = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.neibaozhuang" @selectbox="form.neibaozhuang = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.caihe" @selectbox="form.caihe = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.shuomingshu" @selectbox="form.shuomingshu = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.jiaodai" @selectbox="form.jiaodai = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.zhengsuo" @selectbox="form.zhengsuo = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.cesuo" @selectbox="form.cesuo = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.chandibiao" @selectbox="form.chandibiao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.qcbiao" @selectbox="form.qcbiao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.dianyabiao" @selectbox="form.dianyabiao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.fengkoubiao" @selectbox="form.fengkoubiao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.tiaoxingbiao" @selectbox="form.tiaoxingbiao = $event"></select-box>
			</td>
			<td>
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.renzhengbiao" @selectbox="form.renzhengbiao = $event"></select-box>
			</td>
			<td colspan="2">
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.qitabiao" @selectbox="form.qitabiao = $event"></select-box>
			</td>
			<td colspan="7">
				<select-box :disabled="changeAble" class="cselect" :select="options" :text="form.katong" @selectbox="form.katong = $event"></select-box>
			</td>
		  </tr>
		  </thead>
		</table>
		
		<table class="table">
		  <tr>
			<th>
			  检测项目
			</th>
			<th>
			  检测内容
			</th>
			<th width="20px">
			  轻缺陷数量
			</th>
			<th width="20px">
			  重缺陷数量
			</th>
			<th width="20px">
			  致命缺陷数量
			</th>
		  </tr>
		  <tr>
			<td width="100px" rowspan="3">
			  外观
			</td>
			<td>
			  <textarea v-model="form.baozhuang" rows="3" cols="120" placeholder="包装：" />
			</td>
			<td>
			  <input v-model="form.wgq1" type="number" min="0" class="cnumber">
			</td>
			<td>
			  <input v-model="form.wgz1" type="number" min="0" class="cnumber">
			</td>
			<td>
			  <input v-model="form.wgzm1" type="number" min="0" class="cnumber">
			</td>
		  </tr>
		  <tr>
			<td>
			  <textarea v-model="form.waiguan" rows="3" cols="120" placeholder="外观：" />
			</td>
			<td>
			  <input v-model="form.wgq2" type="number" min="0" class="cnumber">
			</td>
			<td>
			  <input v-model="form.wgz2" type="number" min="0" class="cnumber">
			</td>
			<td>
			  <input v-model="form.wgzm2" type="number" min="0" class="cnumber">
			</td>
		  </tr>
		  <tr>
			<td>
			  <textarea v-model="form.jiegouzuzhuang" rows="3" cols="120" placeholder="结构组装：" />
			</td>
			<td>
			  <input v-model="form.wgq3" type="number" min="0" class="cnumber">
			</td>
			<td>
			  <input v-model="form.wgz3" type="number" min="0" class="cnumber">
			</td>
			<td>
			  <input v-model="form.wgzm3" type="number" min="0" class="cnumber">
			</td>
		  </tr>
		  <tr>
			<td width="100px">
			  性能
			</td>
			<td>
			  <table class="intable">
					<tr>
					<td>充电方式:</td><td><input v-model="form.chongdianfangshi"></td>
					</tr>
					<tr>
					<td>电池批号:</td><td><input v-model="form.dianchipihao"></td>
					</tr>
					<tr>
					<td>充电电流标准:</td><td><input v-model="form.chongdiandianliubiaozhun"></td>
					<td>测试值:</td><td><input v-model="form.ceshi1"></td>
					</tr>
					<tr>
					<td>漏电流标准:</td><td><input v-model="form.loudianliubiaozhun"></td>
					<td>测试值:</td><td><input v-model="form.ceshi2"></td>
					</tr>
					<tr>
					<td>工作电流标准:</td><td><input v-model="form.gongzuodianliubiaozhun"></td>
					<td>测试值:</td><td><input v-model="form.ceshi3"></td>
					</tr>
					<tr>
					<td /><td><input v-model="form.kongbai1"></td>
					<td>测试值:</td><td><input v-model="form.ceshi4"></td>
					</tr>
					<tr>
					<td /><td><input v-model="form.kongbai2"></td>
					<td>测试值:</td><td><input v-model="form.ceshi5"></td>
					</tr>
					<tr>
					<td /><td><input v-model="form.kongbai3"></td>
					<td>测试值:</td><td><input v-model="form.ceshi6"></td>
					</tr>
					<tr>
					<td /><td><input v-model="form.kongbai4"></td>
					<td>测试值:</td><td><input v-model="form.ceshi7"></td>
					</tr>
				</table>
				<textarea v-model="form.gongnengceshi" rows="6" cols="60" placeholder="性能测试：" />
			</td>
			<td>
			  <input type="number" min="0" class="cnumber" v-model="form.wgq4" >
			</td>
			<td>
			  <input type="number" min="0" class="cnumber" v-model="form.wgz4" >
			</td>
			<td>
			  <input type="number" min="0" class="cnumber" v-model="form.wgzm4" >
			</td>
		  </tr>
		</table>
		
		
		
		<view class="condiv">
		  <view class="ditem">
			<view>
			  <view class="lditem">
				落地测试：<select-box style="width: 200px;" :select="downtests" :text="form.downtest"  @selectbox="luodiClick"></select-box>
			  </view>
			  <view class="lditem" style="display: flex">
				<view>高压测试</view>
				<view class="wditem">
					<checkbox-group>
						<view ><label><checkbox :disabled="form.downtest == '/'" @click="gaoyaClick('A')" value="A" name="gaoya" :checked="'A' == form.gaoya"/>1500V 5mA 3秒</label></view>
						<view><label><checkbox :disabled="form.downtest == '/'" @click="gaoyaClick('B')" value="B" name="gaoya" :checked="'B' == form.gaoya"/> 3000V 5mA 3秒 </label></view>
						<view ><label style="display: flex;"><checkbox :disabled="form.downtest == '/'" @click="gaoyaClick('C')" value="C" name="gaoya" :checked="'C' == form.gaoya" />
							<input :disabled="form.downtest == '/'" v-model="form.gaoyai" type="number" style="width: 60px"/>V 5mA 3秒 </label></view>
					</checkbox-group>
				</view>
			  </view>
			  <view>
				<view class="lditem">
				  检测水平：<select-box  :disabled="changeAble" style="width: 200px;" :select="levels" :text="form.level" @selectbox="changeLevel"></select-box>
				</view>
				<view class="lditem">
				  结果：
				  <span class="mditem">A<input v-model="form.jieguoa" class="mditem minp" type="number">台</span>
				  <span  class="mditem">B<input v-model="form.jieguob"  class="mditem minp" type="number">台</span>
				  <span class="mditem">C<input v-model="form.jieguoc" class="mditem minp" type="number">台</span>
				</view>
			  </view>
			</view>
			<view>
			  <view class="lditem">
				AQL值：
				<span>
				  A：<select-box class="cselect" :select="grades" style="width: 100px" :text="form.aqla"  @selectbox="changeAqla"></select-box>
				</span>
				<span>
				  B：<select-box class="cselect" :select="grades" style="width: 100px" :text="form.aqlb" @selectbox="changeAqlb"></select-box>
				</span>
				<span>
				  C：<select-box class="cselect" :select="grades" style="width: 100px" :text="form.aqlc" @selectbox="changeAqlc"></select-box>
				</span>
			  </view>
			  <view class="lditem" style="display: flex">
				AC/RE值：
				<view class="uspan">
				  A:<u>__{{ form.aca }}__/___{{ form.rea }}__</u>
				</view>
				<view class="uspan">
				  B:<u>__{{ form.acb }}__/__{{ form.reb }}__</u>
				</view>
				<view class="uspan">
				  C:<u>__{{ form.acc }}__/__{{ form.rec }}__</u>
				</view>
			  </view>
			  <view style="display: flex">
				<view>
				  判定：
				</view>
				<view>
					<radio-group @change="pandingChange">
						<view>
							<label><radio value="合格" name="panding" :checked="form.panding != '不合格'"/>合格</label>
						</view>
						<view>
							<label><radio value="不合格" name="panding" :checked="form.panding == '不合格'"/>不合格</label>
						</view>
					</radio-group>
				  </view>
				</view>
			  </view>
			</view>
		  </view>
	  <uni-card title="总评">
		<view style="width: 280upx;margin-bottom: 10upx;">
			<uni-file-picker 
				auto-upload
				:value="imageValue"
				fileMediatype="image"
				mode="grid" 
				:limit="6"
				@select="select" 
				@progress="progress" 
				@success="success" 
				@fail="fail" 
				@delete="del"
				:auto-upload="true"
			/>
		</view>
		<!-- <view>
			<uni-easyinput v-model="quality.describe"  placeholder="备注" ></uni-easyinput>
		</view> -->
		<view style="margin: 20upx 50upx;display: flex;" >
			<button style="width: 200rpx;" type="primary" @click="saveEdit">保存</button>
			<button style="width: 200rpx;" type="warn" :disabled="!form.id||(form.id && form.measurement)" @click="openPopup">审核</button>
		  </view>
	  </uni-card>
	  <uni-popup ref="popup" type="center" :animation="false" :mask-click="false">
		  <view style="background-color: #FFFFFF;width: 500upx;height: 250upx;padding: 20upx;">
			  <radio-group @change="measurementChange" >
			  	<label><radio value="合格" name="measurement"/>合格</label>
				<label><radio value="特采" name="measurement"/>特采</label>
				<label><radio value="全检" name="measurement"/>全检</label>
				<label><radio value="返工" name="measurement"/>返工</label>
			  </radio-group>
			  <textarea v-model="form.remark" rows="3" cols="100" placeholder="审核备注" style="margin: 5upx;"/>
			  <view style="display: flex; ">
				  <button style="width: 100rpx;margin-top: 5upx;" @click="closePopup">取消</button>
				  <button style="width: 200rpx;margin-top: 5upx;" type="primary" @click="saveEdit">确定</button>
			  </view>
		  </view>
	  </uni-popup>
	  
	  <uni-popup ref="showPop" type="center" :animation="false" :mask-click="false">
	  	<view style="background-color: #FFFFFF;width: 600upx;height: 250upx;padding: 40upx;margin-top: 60upx;">
			<view class="rowborder">
				<view>
					<button size="mini" type="default" @click="closeShowPop()">取消</button>
				</view>
<!-- 					<view>
					<picker mode="date" :value="query.ddate" @change="bindDateChange"  class="topborder">
						<text class="inputborder">日期:{{query.ddate}}</text>
					</picker>
				</view> -->
				<view class="billflex">
					<uni-easyinput placeholder="产品编码" v-model="query.cinvcode" class="inputbill" ></uni-easyinput>
					<uni-easyinput placeholder="单号" v-model="query.ccode" class="inputbill" ></uni-easyinput>
					<uni-easyinput placeholder="需求跟踪号" v-model="query.csocode" class="inputbill" ></uni-easyinput>
					<button size="mini" type="default" @click="findAll">查询</button>
				</view>
			</view>
			
	  		<scroll-view  scroll-y="true" style="height: 220upx;">
	  			<view v-for="item,index in bills" v-bind:key="index"  @click="selBill(index)">
	  				<view style="color: #ff0000;float: right;margin: 20upx;">{{item.cBDefine13?item.cBDefine13:'待质检' }}</view>
	  				<view><text class="itemth">单号:</text><text class="itmemain">{{item.cCode}}</text></view>
	  				<view><text class="itemth">供应商名称:</text><text class="itmemain">{{item.cVenName}}</text></view>
	  				<view style="display: flex;">
	  					<view style="width: 300px;"><text class="itemth">编码:</text><text class="itmemain">{{item.cInvCode}}</text></view>
	  					<view><text class="itemth">产品:</text><text class="itmemain">{{item.cInvName}}</text></view>
	  				</view>
	  				<view style="display: flex;">
	  					<view style="width: 300px;"><text class="itemth">数量:</text><text class="itmemain">{{item.iQuantity}}</text></view>
	  					<view><text class="itemth">待检数:</text><text class="itmemain">{{item.qcyqty}}</text></view>
	  				</view>
	  				<view style="display: flex;">
	  					<view style="width: 300px;"><text class="itemth">规格:</text><text class="itmemain">{{item.cInvStd}}</text></view>
	  					<view><text class="itemth">需求跟踪号:</text><text class="itmemain">{{item.csocode}}</text></view>
	  				</view>
	  				<view style="display: flex;">
	  					<view style="width: 300px;"><text class="itemth">产品型号:</text><text class="itmemain">{{item.csoinvname}}</text></view>
	  					<view><text class="itemth">日期:</text><text class="itmemain">{{item.dDate}}</text></view>
	  				</view>
	  				<hr/>
	  			</view>
	  		</scroll-view>
	  	</view>
	  </uni-popup>
	</view>
</template>

<script>
import selectBox from '../../components/select-box/select-box.vue'
	export default {
		components:{
			selectBox
		},
		onLoad(option) {
			if(option.id){
				this.getRpInCome(option.id)
			}
			if(option.autoid){
				this.getBillByAotoid(option.autoid)
			}
			if(option.barcodes){
				this.barcodes = JSON.parse(option.barcodes)
				this.getRpInComeBycbarcode(this.barcodes[0].cbarcode)
			}
		},
		created() {
			this.findAll()
		},
		data() {
			return {
				fileUploadUrl:this.$http.baseUrl,
				downtests: ['/','合格', '不合格', '不适用'],
				editVisible: false,
				form: {guochong:'',qualitytype:'批次质检',billtype:'生产质检',panding:'合格'},
				query: {
					csocode:'',
					pageIndex: 1,
					pageSize: 100,
				},
				page: [],
				grades: [0, 0.01,0.015,0.025,0.04,0.065,0.1,0.25, 0.4, 0.65, 1.0, 1.5, 2.5, 4.0, 6.5, 10, 15, 25,65,100,150,250,650,1000],
				levels: ['S-1', 'S-2', 'S-3', 'S-4', 'I', 'II', 'III'],
				options: ['/', '√', '×'],
				datas: [],
				imageValue : [],
				//imageValue:[{url:'http://120.237.35.182:8088/img/6800000004.jpg'}],
				images:[],
				qctype:'',
				open:false,
				index:0,
				barcodes:[],
				bills:[],
				quality:{aqla:''},
			}
		},
		methods: {
			copy(){
				this.findPPbarcodeBymodid(this.form.modid)
				this.openshowPPbarcode()
			},
			openShowPop(){
				this.$refs.showPop.open();
			},
			closeShowPop(){
				this.$refs.showPop.close();
			},
			luodiClick(e){
				this.form.downtest = e
				if(this.form.downtest != '/'){
					this.form.gaoya = ''
				}
				this.$forceUpdate()
			},
			gaoyaClick(e){
				if(this.form.downtest != '/'){
					this.form.gaoya = e == this.form.gaoya ? '' : e
					this.$forceUpdate()
				}			},
			openPopup(){
				this.$refs.popup.open()
			},
			closePopup(){
				this.form.measurement = undefined
				this.$refs.popup.close()
			},
			billtypeChange($event){
				this.form.billtype = $event.target.value
			},
			qualitytypeChange($event){
				this.form.qualitytype = $event.target.value
			},
			pandingChange($event){
				this.form.panding = $event.target.value
			},
			measurementChange($event){
				console.log($event.target.value)
				this.form.measurement = $event.target.value
			},
			gaoyaChange($event){
				let val = $event.target.value
				if(val.length = 1){
					this.form.gaoya = ''
					this.$forceUpdate()
				}else{
					this.$set(this.form,'gaoya','')
				}
			},
			getRpInCome(id){
				this.$http.get(
					"rpInCome/get",
					{
						id:id
					}
				).then(res=>{
					const row = res.data.data.data
					this.form = row
					for(const image of this.form.images){
						this.imageValue.push({'url':this.fileUploadUrl+image.imgUrl,'imgUrl':image.imgUrl})
					}
					this.barcodes = row.barcodes
					this.$forceUpdate()
				})
			},
			selBill(index){
				let row = this.bills[index]
				console.log(this.form)
				this.form.ccode = row.cCode
				this.form.mdepcode = row.cDepCode
				this.form.cdepname = row.cDepName
				this.form.csocode = row.csocode
				this.form.qty = row.iQuantity
				this.form.qcyqty = 0;
				for(const bar of this.barcodes){
					this.form.qcyqty += bar.qty
				}
				this.form.ccomunitname = row.cComUnitName
				this.form.autoid = row.AutoID
				this.form.cinvcode = row.cInvCode
				this.form.cinvname = row.cInvName
				this.form.cinvstd = row.cInvStd
				this.form.ddate = row.dDate
				this.form.isosid = row.iSOsID
				this.form.csoinvname = row.csoinvname
				this.diffValue(this.form)
				
				this.changeLevel('II');
				this.form.measurement = undefined
				this.closeShowPop()
			},
			findAll(){
				this.$http.post(
					"incomep/query",
					this.query
				).then(res=>{
					this.bills = res.data.data.page.content
				})
					
			},
			getBillByAotoid(id){
				this.$http.get(
					"incomep/get",
					{
						id:id
					}
				).then(res=>{
					const row = res.data.data.data
					console.log(row)
					if(!row){
						uni.showToast({
							title: '订单已关闭',
							duration: 2000
						});
						return
					}
					this.form.ccode = row.cCode
					this.form.mdepcode = row.cDepCode
					this.form.cdepname = row.cDepName
					this.form.csocode = row.csocode
					this.form.qty = row.iQuantity
					this.form.qcyqty = 0;
					for(const bar of this.barcodes){
						this.form.qcyqty += bar.qty
					}
					this.form.ccomunitname = row.cComUnitName
					this.form.autoid = row.AutoID
					this.form.cinvcode = row.cInvCode
					this.form.cinvname = row.cInvName
					this.form.cinvstd = row.cInvStd
					this.form.ddate = row.dDate
					this.form.isosid = row.iSOsID
					this.form.csoinvname = row.csoinvname
					this.form.cfree2 = row.cFree2
					this.form.cdefine33 = row.cDefine33
					console.log(this.form)
					
					if(!this.form.id){
						this.diffValue(this.form)
						this.changeLevel('II');
					}
					this.form.measurement = undefined
					this.$forceUpdate()
				})
			},
			diffValue(data){
				data.guochong = '√'
				data.guofang = '√'
				data.dc = '√'
				data.ac = '√'
				data.sac = '√'
				data.dianya = '√'
				data.dianyuanxian = '√'
				data.chondian = '√'
				data.laxiankaiguan = '√'
				data.jiancekaiguan = '√'
				data.fanguangzhi = '√'
				data.fangshui = '√'
				data.waizhitianxian = '√'
				data.ledchuan = '√'
				data.ledbing = '√'
				data.diantongdan = '√'
				data.diantongshuang = '√'
				data.diantongsan = '√'
				data.shedengled = '√'
				data.shedengdanzhu = '√'
				data.dianchipainshu = '√'
				data.dianchizhongliang = '√'
				data.shiyongshijian = '√'
				data.suojianyongliao = '√'
				data.suojianyanse = '√'
				data.zhengdeng = '√'
				data.pcs = '√'
				data.sandjian = '√'
				data.kehuxinghao = '√'
				data.pingpai = '√'
				data.guangguan = '√'
				data.dianchi = '√'
				data.suojian = '√'
				data.neibaozhuang = '√'
				data.caihe = '√'
				data.shuomingshu = '√'
				data.jiaodai = '√'
				data.zhengsuo = '√'
				data.cesuo = '√'
				data.chandibiao = '√'
				data.qcbiao = '√'
				data.dianyabiao = '√'
				data.fengkoubiao = '√'
				data.tiaoxingbiao = '√'
				data.renzhengbiao = '√'
				data.qitabiao = '√'
				data.katong = '√'
				
				data.wgq1 = 0 
				data.wgz1 = 0 
				data.wgzm1 = 0 
				
				data.wgq2 = 0
				data.wgz2 = 0 
				data.wgzm2 = 0 
				
				data.wgq3 = 0
				data.wgz3 = 0 
				data.wgzm3 = 0 
				
				data.wgq4 = 0
				data.wgz4 = 0 
				data.wgzm4 = 0 
				
				data.level = 'II'
				data.jieguoa = 0
				data.jieguob = 0
				data.jieguoc = 0
				
				data.downtest = '/'
			},
			getRpInComeBycbarcode(cbarcode){
				this.$http.get(
					"rpInCome/findRpIncomeByBarcode",
					{
						cbarcode
					}
				).then(res=>{
					const row = res.data.data.data
					if(row){
						row.id = null
						row.measurement = null
						this.form = row
						this.form.qcyqty = 0
						for(const bar of this.barcodes){
							this.form.qcyqty += bar.qty
						} 
						for(const image of this.form.images){
							this.imageValue.push({'url':this.fileUploadUrl+image.imgUrl,'imgUrl':image.imgUrl})
						}
						this.changeQcyqty(1)
						this.$forceUpdate()
					}
				})
			},
			copyOriginBill(){
				this.form.id = null
				this.form.images = []
				this.form.measurement = null
				uni.showToast({
					title: '复制成功',
					duration: 2000
				});
				this.$forceUpdate()
			},
			bindPickerChange(){
				this.setQuality(this.datas[this.index])
			},
			radioChange(e){
				this.quality.measurement = e.detail.value
			},
			showDrawer(){
				this.$refs.drawer.open()
			},
			selbox(index,type){
				this.quality.entitys[index][type] =  this.quality.entitys[index][type] === '符合' ? '不符合' : '符合' 
			},
			selresult(index){
				this.quality.entitys[index].result =  this.quality.entitys[index].result === '合格' ? '不合格' : '合格'
				this.quality.entitys = JSON.parse(JSON.stringify(this.quality.entitys))
			},
			saveEdit() {
				let images = []
				for (const image of this.imageValue) {
					images.push({ imgUrl: image.imgUrl})
				  }
				this.form.images = images
				this.form.barcodes = this.barcodes
				this.$http.post(
					"rpInCome/save",
					this.form
				).then(res=>{
				if(res.data.code === 200){
					uni.showToast({
						title: '保存成功',
						duration: 2000
					});
					const row = res.data.data.data
					this.imageValue = []
					this.form = row
					for(const image of this.form.images){
						this.imageValue.push({'url':this.fileUploadUrl+image.imgUrl,'imgUrl':image.imgUrl})
					}
					this.$refs.popup.close()
				}else{
					uni.showToast({
						icon:'error',
						title: res.data.message,
						duration: 2000
					});
				}
				})
			},
			  // 获取上传状态
			select(e){
				this.$http.upload(e.tempFilePaths[0]).then(res =>{
					const data = JSON.parse(res.data);
					this.imageValue.push({'url':this.fileUploadUrl+data.data.data,'imgUrl':data.data.data})
				})
				console.log(e)
			},
			// 获取上传进度
			progress(e){
				console.log('上传进度：',e)
			},

			// 上传成功
			success(e){
				console.log('上传成功')
			},
			// 上传失败
			fail(e){
				console.log('上传失败：',e)
			},
			del(e){
				console.log('图片删除：',e)
				for(const i in this.imageValue){
					if(this.imageValue[i].url == e.tempFilePath){
						this.imageValue.splice(i,1)
					}
				}
			},
			changeAqla(e) {
				this.form.aqla = e
			  if (!this.form.level) {
				uni.showToast({
				    title: '请检测质检等级',
					icon:'error'
				});
				return
			  }
			  if (!this.form.qcyqty) {
				uni.showToast({
				    title: '请先选择单据',
					icon:'error'
				});
				return
			  }
			  if (this.form.aqla == 0) {
				this.form.aca = 0
				this.form.rea = 0
				this.$forceUpdate()
			  } else {
				const data = { level: this.form.level, qty: this.form.qcyqty, grade: this.form.aqla }
				this.$http.get(
					"qmilcode/get",
					data
				).then(res => {
				  this.form.aca = res.data.data.data.ac
				  this.form.rea = res.data.data.data.re
				  this.form = JSON.parse(JSON.stringify(this.form))
				})
			  }
			},
			changeAqlb(e) {
				this.form.aqlb = e
			  if (!this.form.level) {
				uni.showToast({
				    title: '请检测质检等级',
					icon:'error'
				});
				return
			  }
			  if (!this.form.qcyqty) {
				uni.showToast({
				    title: '请先选择单据',
					icon:'error'
				});
				return
			  }
			  if (this.form.aqlb == 0) {
				this.form.acb = 0
				this.form.reb = 0
				this.$forceUpdate()
			  } else {
				const data = { level: this.form.level, qty: this.form.qcyqty, grade: this.form.aqlb }
				this.$http.get(
					"qmilcode/get",
					data
				).then(res => {
				  this.form.acb = res.data.data.data.ac
				  this.form.reb = res.data.data.data.re
				  this.form = JSON.parse(JSON.stringify(this.form))
				})
			  }
			},
			changeAqlc(e) {
				this.form.aqlc = e
			  if (!this.form.level) {
				uni.showToast({
				    title: '请检测质检等级',
					icon:'error'
				});
				return
			  }
			  if (!this.form.qcyqty) {
				 uni.showToast({
				     title: '请先选择单据',
					icon:'error'
				 });
				return
			  }
			  if (this.form.aqlc == 0) {
				this.form.acc = 0
				this.form.rec = 0
				this.$forceUpdate()
			  } else {
				const data = { level: this.form.level, qty: this.form.qcyqty, grade: this.form.aqlc }
				this.$http.get(
					"qmilcode/get",
					data
				).then(res => {
				  this.form.acc = res.data.data.data.ac
				  this.form.rec = res.data.data.data.re
				  this.form = JSON.parse(JSON.stringify(this.form))
				})
			  }
			},
			changeQcyqty(e){
				if(this.form.level){
					this.changeLevel(this.form.level)
				}
			},
			changeLevel(e) {
				this.form.level = e
			  if (this.form.aqla) {
				this.changeAqla(this.form.aqla)
			  }
			  if (this.form.aqlb) {
				this.changeAqlb(this.form.aqlb)
			  }
			  if (this.form.aqlc) {
				this.changeAqlc(this.form.aqlc)
			  }
			  this.changeDemo()
			},
			changeDemo(){
				if(this.form.level && this.form.qcyqty){
					  this.$http.get(
						"qmilcode/findDemoByLevelAndQty",
						{level:this.form.level,qty:this.form.qcyqty}
					  ).then(res => {
						  if(200 == res.data.code){
							  this.form.checkqty = res.data.data.data.ISAMPLEQTY
							  this.$forceUpdate()
						  }
					  })
				}
				this.$forceUpdate()
			},
			getBarcode(barcode){
				this.$http.get(
					"ppbarcode/findByBarcode",
					{
						barcode:barcode
					}
				).then(res=>{
					if(res.data.data.page){
						const item = res.data.data.page;
						if(item.accept == 0){
							uni.showToast({
							    title: '条码未接收',
								icon:'error'
							});
							return;
						}
						if(item.cwhcode){
							uni.showToast({
							    title: '已入库无法检验',
								icon:'error'
							});
							return;
						}
						this.copyBill(item.modid)
					}else{
						uni.showToast({
						    title: '条码不存在',
							icon:'error'
						});
					}
				})
			},
			scan(){
				let there = this
				uni.scanCode({
				    onlyFromCamera: true,
				    success: function (res) {
				        console.log('条码内容：' + res.result);
						there.getBarcode(res.result)
				    }
				});
			},
			bindDateChange(e){
				this.form.ddate = e.detail.value
			},
		},
		computed:{
			changeAble(){
				return this.form.measurement
			}
		}
	}
</script>

<style lang="scss">
	.scroll-Y{
		height: 250upx;
	}
	.container {
		font-size: 12px;
		height: 100%;
		background-color: #f0faff;
	}
	 .cbody{
	    background-color: #fcfcfc;
	  }
	  input{
		  background-color: #dedede;
	  }
	  select{
	    -webkit-appearance:none;
	    -moz-appearance:none;
	    appearance:none;
	  }
	  .content{
	    margin: 5px auto;
	    padding: 10px;
	    font-weight: 400;
	    background-color: #f7f7f7;
	    text-align: center;
	  }
	  textarea{
		  width: 100%;
		  text-align: left;
		  padding: 2upx;
		  background-color: #c7c7c7;
	  }
	  .topth{
	    width: 100px;
	  }
	  .condiv{
	    text-align: left;
	    border-width: thin;
	    border-color: #c7c7c7;
	    border-style: solid;
	  }
	  .table{
	    border-collapse: collapse;
	    border-color: #c7c7c7;
	  }
	  .lditem{
		display: flex;
	    margin: 15px 0;
	  }
	  .wditem{
		display: flex;
	    margin: 0 15px;
	  }
	  .uspan{
	    margin: 0 5px;
	  }
	  .mditem{
		display: flex;
	    margin: 0 8px;
	  }
	  .minp{
	    width: 30px;
	  }
	  td{
		text-align: center;
	    border-style: solid;
	    border-width: thin;
	    border-color: #c7c7c7;
	  }
	  .handle-input {
	    margin: 10px;
	    width: 300px;
	    display: inline-block;
	  }
	  .table {
	    width: 100%;
	  }
	  .mincell{
		font-size: 12px;
	    width: 20px;
	  }
	  col2{
	    colspan:2
	  }
	  .cselect{
	    height: 20px;
	    width: 20px;
	    text-align: center;
	    border-width: 0;
	    background-color: #ffffff;
	    font-weight: bold;
	  }
	  th{
	    border-style: solid;
	    border-width: thin;
	    font-weight: 400;
	    border-color: #c7c7c7;
	  }
	  .cnumber{
	    width: 90px;
	  }
	  .ditem{
	    padding: 20px;
	    display: flex;
	    justify-content: space-between;
	  }
	  .red {
	    color: #ff0000;
	  }
	  .hand-btn {
	    margin: 5px;
	  }
	  .gaoya{
	    padding-left: 10px;
	  }
	  .rowborder {
	  	display: flex;
	  	flex-direction: row;
	  	justify-content: space-between;
	  	margin: 3rpx;
	  }
	  .billflex {
	  	display: flex;
	  	flex-direction: row;
	  	margin-right: 10rpx;
	  	width: 500rpx;
	  }
</style>
